#coding:gbk

from smartcard import *

def int2bytes(n):
    bytes = []
    while n != 0:
        v = n & 0xFF
        n >>= 8
        bytes.append(chr(v))
    bytes.reverse()
    return ''.join(bytes)

def get_prime_list(count):
    prime_list = []
    i = 0

    n = 2
    while True:
        bytes = int2bytes(n)
        if mplib_is_prime(bytes):
            i += 1
            prime_list.append(n)
            if i == count:
                break
        n += 1
    return prime_list


def dump_list(L):
    for i in range(len(L)):
        print "0x%08X," %(L[i]),
        if i % 0x08 == 0x07:
            print

def main():
    L = get_prime_list(256 * 256)
    dump_list(L)

main()

